﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using C1.Win.C1Input;
    using Excel;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptDoanhThuChiTiet : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("AdvKhachHang")]
        private ADVObjects _AdvKhachHang;
        [AccessedThroughProperty("AdvNhanVien")]
        private ADVObjects _AdvNhanVien;
        [AccessedThroughProperty("CboLoaiTien")]
        private ComboBox _CboLoaiTien;
        [AccessedThroughProperty("CmdExel")]
        private System.Windows.Forms.Button _CmdExel;
        [AccessedThroughProperty("CmdLoad")]
        private System.Windows.Forms.Button _CmdLoad;
        [AccessedThroughProperty("CmdSeachMaHang")]
        private System.Windows.Forms.Button _CmdSeachMaHang;
        [AccessedThroughProperty("Label1")]
        private System.Windows.Forms.Label _Label1;
        [AccessedThroughProperty("Label11")]
        private System.Windows.Forms.Label _Label11;
        [AccessedThroughProperty("Label13")]
        private System.Windows.Forms.Label _Label13;
        [AccessedThroughProperty("Label16")]
        private System.Windows.Forms.Label _Label16;
        [AccessedThroughProperty("Label2")]
        private System.Windows.Forms.Label _Label2;
        [AccessedThroughProperty("Label23")]
        private System.Windows.Forms.Label _Label23;
        [AccessedThroughProperty("Label3")]
        private System.Windows.Forms.Label _Label3;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("Panel3")]
        private Panel _Panel3;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtMaHang")]
        private System.Windows.Forms.TextBox _TxtMaHang;
        [AccessedThroughProperty("TxtTongThanhToanNT")]
        private C1NumericEdit _TxtTongThanhToanNT;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;

        [DebuggerNonUserCode]
        public Frm_RptDoanhThuChiTiet()
        {
            base.Load += new EventHandler(this.Frm_RptDoanhThuChiTiet_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdExel_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog dialog = new SaveFileDialog {
                    Filter = "Excel Files|*.xls",
                    Title = "Save an Excel file"
                };
                dialog.ShowDialog();
                if (dialog.FileName != "")
                {
                    this.VSlist.SaveExcel(dialog.FileName, "DoanhThu", FileFlags.IncludeFixedCells);
                    Excel.Application application = new ApplicationClass();
                    Workbook workbook = application.Workbooks.Open(dialog.FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
                    application.Visible = true;
                }
            }
            catch (COMException exception1)
            {
                ProjectData.SetProjectError(exception1);
                COMException exception = exception1;
                MessageBox.Show(exception.Message);
                ProjectData.ClearProjectError();
            }
            catch (Exception exception3)
            {
                ProjectData.SetProjectError(exception3);
                Exception exception2 = exception3;
                MessageBox.Show(exception2.Message);
                ProjectData.ClearProjectError();
            }
        }

        private void CmdLoad_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CmdSeachMaHang_Click(object sender, EventArgs e)
        {
            string expression = "";
            expression = SearchModule.SearchHangHoa("", modGeneral.H_STOCKID, "");
            if (expression.Trim() != "")
            {
                string[] strArray = Strings.Split(expression, "|", -1, CompareMethod.Binary);
                this.TxtMaHang.Tag = strArray[0];
                this.TxtMaHang.Text = strArray[1];
            }
            else
            {
                this.TxtMaHang.Tag = "";
                this.TxtMaHang.Text = "";
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_RptDoanhThuChiTiet_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
                BuildComboModule.BuildCombo(this.CboLoaiTien, modGeneral.ListDanhMuc.LoaiTien, true, "", "");
                LVYModule.advFormatNumber(this.TxtTongThanhToanNT, modGeneral.H_FORMATNUMBER);
                if (modGeneral.H_GIOIHANDULIEU)
                {
                    this.AdvNhanVien.Value = modGeneral.H_USERID;
                    this.AdvNhanVien.ReadOnly = true;
                }
                else
                {
                    this.AdvNhanVien.Value = "";
                    this.AdvNhanVien.ReadOnly = false;
                }
                this.LoadData();
            }
        }

        public object GetData(string strLanguage = "VIET")
        {
            string str2 = "";
            string str3 = "";
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.TxtMaHang.Tag), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                str2 = str2 + " AND CT.KhoaHangHoa ='" + this.TxtMaHang.Tag.ToString().Trim() + "'";
                str3 = str3 + " AND CT.KhoaHangHoa ='" + this.TxtMaHang.Tag.ToString().Trim() + "'";
            }
            if (this.AdvKhachHang.Value.Trim() != "")
            {
                str2 = str2 + " AND XK.KhoaDoiTuong = '" + this.AdvKhachHang.Value + "'";
                str3 = str3 + " AND NK.KhoaDoiTuong = '" + this.AdvKhachHang.Value + "'";
            }
            if (this.AdvNhanVien.Value.Trim() != "")
            {
                str2 = str2 + " AND XK.KhoaNhanVienBanHang = '" + this.AdvNhanVien.Value + "'";
                str3 = str3 + " AND NK.KhoaNhanVien = '" + this.AdvNhanVien.Value + "'";
            }
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboLoaiTien.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() != "")
            {
                str2 = str2 + " AND Rtrim(XK.LoaiTien) = '" + this.CboLoaiTien.SelectedValue.ToString().Trim() + "'";
                str3 = str3 + " AND Rtrim(NK.LoaiTien) = '" + this.CboLoaiTien.SelectedValue.ToString().Trim() + "'";
            }
            string commandText = "SELECT DBO.Char2Date(XK.NgayChungTu) As Ngay, XK.SoChungTu, HH.Ma As MaHang, HH.Ten" + strLanguage + " As HangHoa, KH.Ten" + strLanguage + " As KhachHang, NV.Ten" + strLanguage + " As KinhDoanh,  XK.LoaiTien, XK.TyGia, CT.SoLuong, GB.GiaBan As GiaList, CT.GiaBanNT As DonGia, CT.TienChietKhauNT As ChietKhau, CT.TienBanNT As ThanhTien,  CT.TienBanNT * XK.TyGia As ThanhTienViet, Sum(CO.TienHoaHongNT) As HoaHong  FROM ST_XuatKho XK  LEFT JOIN ST_XuatKhoChiTiet CT ON XK.Khoa = CT.KhoaPhieuXuat  LEFT JOIN DM_HangHoa HH ON CT.KhoaHangHoa = HH.Khoa  LEFT JOIN DM_DoiTuong KH ON XK.KhoaDoiTuong = KH.Khoa  LEFT JOIN DM_DoiTuong NV ON XK.KhoaNhanVienBanHang = NV.Khoa  LEFT JOIN BH_GiaBan GB ON HH.Khoa = GB.KhoaHangHoa AND GB.GiaChuan = 1 AND RTRIM(GB.LoaiTien) = 'USD'  LEFT JOIN ST_HoaHongChiTiet CO ON CT.Khoa = CO.Khoa  WHERE 1 = 1 AND XK.LoaiChungTu = 'XB' AND (XK.NgayChungTu BETWEEN '" + LVYModule.Date2Char(this.TxtTuNgay.Text) + "' And '" + LVYModule.Date2Char(this.TxtDenNgay.Text) + "' AND XK.LoaiBanHang = 'XB' AND XK.GhiSo = 1)" + str2 + " GROUP BY  XK.NgayChungTu, XK.SoChungTu, HH.Ma , HH.Ten" + strLanguage + " , KH.Ten" + strLanguage + " , NV.Ten" + strLanguage + " , XK.LoaiTien, XK.TyGia, CT.SoLuong, GB.GiaBan ,  CT.GiaBanNT, CT.TienChietKhauNT, CT.TienBanNT , CT.TienBanNT   UNION ALL  SELECT DBO.Char2Date(NK.NgayChungTu) As Ngay, NK.SoChungTu, HH.Ma As MaHang, HH.Ten" + modGeneral.H_LANGUAGE + " As HangHoa, KH.TenVIET As KhachHang,  NV.Ten" + modGeneral.H_LANGUAGE + " As KinhDoanh,  NK.LoaiTien, NK.TyGia, - CT.SoLuong, GB.GiaBan As GiaList, CT.GiaBanNT As DonGia, CT.TienChietKhauNT As ChietKhau,- CT.TienBanNT As ThanhTien, - CT.TienBanNT * NK.TyGia As ThanhTienViet,  0 AS HoaHong  FROM ST_NhapKho NK  LEFT JOIN ST_NhapKhoChiTiet CT ON NK.Khoa = CT.KhoaPhieuNhap LEFT JOIN ST_XuatKho XK ON NK.KhoaDonHang = XK.Khoa AND XK.LoaiChungTu = 'XB'  LEFT JOIN DM_HangHoa HH ON CT.KhoaHangHoa = HH.Khoa   LEFT JOIN DM_DoiTuong KH ON NK.KhoaDoiTuong = KH.Khoa   LEFT JOIN DM_DoiTuong NV ON NK.KhoaNhanVien = NV.Khoa   LEFT JOIN BH_GiaBan GB ON HH.Khoa = GB.KhoaHangHoa AND GB.GiaChuan = 1 AND RTRIM(GB.LoaiTien) = 'USD'  WHERE 1 = 1 AND (NK.NgayChungTu BETWEEN '" + LVYModule.Date2Char(this.TxtTuNgay.Text) + "' And '" + LVYModule.Date2Char(this.TxtDenNgay.Text) + "') AND NK.NguonNhap ='TH'" + str3 + " GROUP BY  NK.NgayChungTu, NK.SoChungTu, HH.Ma , HH.Ten" + modGeneral.H_LANGUAGE + " , KH.Ten" + modGeneral.H_LANGUAGE + " , NV.Ten" + modGeneral.H_LANGUAGE + " , NK.LoaiTien, NK.TyGia,  CT.SoLuong, GB.GiaBan, CT.GiaBanNT, CT.TienChietKhauNT, CT.TienBanNT, CT.TienBanNT";
            return DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptDoanhThuChiTiet));
            this.Panel1 = new Panel();
            this.CmdExel = new System.Windows.Forms.Button();
            this.CmdLoad = new System.Windows.Forms.Button();
            this.CboLoaiTien = new ComboBox();
            this.Label11 = new System.Windows.Forms.Label();
            this.Label2 = new System.Windows.Forms.Label();
            this.AdvNhanVien = new ADVObjects();
            this.Label3 = new System.Windows.Forms.Label();
            this.CmdSeachMaHang = new System.Windows.Forms.Button();
            this.TxtMaHang = new System.Windows.Forms.TextBox();
            this.Label16 = new System.Windows.Forms.Label();
            this.AdvKhachHang = new ADVObjects();
            this.Label1 = new System.Windows.Forms.Label();
            this.TxtDenNgay = new DateTimePicker();
            this.Label13 = new System.Windows.Forms.Label();
            this.TxtTuNgay = new DateTimePicker();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel2 = new Panel();
            this.Panel3 = new Panel();
            this.TxtTongThanhToanNT = new C1NumericEdit();
            this.Label23 = new System.Windows.Forms.Label();
            this.Panel1.SuspendLayout();
            this.VSlist.BeginInit();
            this.Panel2.SuspendLayout();
            this.Panel3.SuspendLayout();
            ((ISupportInitialize) this.TxtTongThanhToanNT).BeginInit();
            this.SuspendLayout();
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdExel);
            this.Panel1.Controls.Add(this.CmdLoad);
            this.Panel1.Controls.Add(this.CboLoaiTien);
            this.Panel1.Controls.Add(this.Label11);
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.AdvNhanVien);
            this.Panel1.Controls.Add(this.Label3);
            this.Panel1.Controls.Add(this.CmdSeachMaHang);
            this.Panel1.Controls.Add(this.TxtMaHang);
            this.Panel1.Controls.Add(this.Label16);
            this.Panel1.Controls.Add(this.AdvKhachHang);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.TxtDenNgay);
            this.Panel1.Controls.Add(this.Label13);
            this.Panel1.Controls.Add(this.TxtTuNgay);
            this.Panel1.Dock = DockStyle.Top;
            System.Drawing.Point point = new System.Drawing.Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            Size size = new Size(0x3e2, 0x2d);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x45;
            this.CmdExel.Image = (Image) manager.GetObject("CmdExel.Image");
            point = new System.Drawing.Point(0x3b7, 0x13);
            this.CmdExel.Location = point;
            this.CmdExel.Name = "CmdExel";
            size = new Size(0x19, 0x18);
            this.CmdExel.Size = size;
            this.CmdExel.TabIndex = 0x7e;
            this.CmdExel.UseVisualStyleBackColor = true;
            this.CmdLoad.BackgroundImage = ACCOUNTING.My.Resources.Resources.view;
            this.CmdLoad.BackgroundImageLayout = ImageLayout.Center;
            point = new System.Drawing.Point(0x39d, 0x13);
            this.CmdLoad.Location = point;
            this.CmdLoad.Name = "CmdLoad";
            size = new Size(0x1a, 0x18);
            this.CmdLoad.Size = size;
            this.CmdLoad.TabIndex = 0x7d;
            this.CmdLoad.UseVisualStyleBackColor = true;
            this.CboLoaiTien.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboLoaiTien.FormattingEnabled = true;
            point = new System.Drawing.Point(0x330, 20);
            this.CboLoaiTien.Location = point;
            this.CboLoaiTien.Name = "CboLoaiTien";
            size = new Size(0x6c, 0x15);
            this.CboLoaiTien.Size = size;
            this.CboLoaiTien.TabIndex = 0x7c;
            this.Label11.AutoSize = true;
            this.Label11.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x32e, 5);
            this.Label11.Location = point;
            this.Label11.Name = "Label11";
            size = new Size(0x2f, 13);
            this.Label11.Size = size;
            this.Label11.TabIndex = 0x7b;
            this.Label11.Text = "Loại tiền";
            this.Label11.TextAlign = ContentAlignment.TopRight;
            this.Label2.AutoEllipsis = true;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x1b6, 4);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            this.Label2.RightToLeft = RightToLeft.No;
            size = new Size(0x3d, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x7a;
            this.Label2.Text = "Kinh doanh";
            this.Label2.TextAlign = ContentAlignment.TopRight;
            this.AdvNhanVien.Conditions = "";
            this.AdvNhanVien.LoaiDoiTuong = modGeneral.TypeObjects.NhanVien;
            point = new System.Drawing.Point(0x1b9, 20);
            this.AdvNhanVien.Location = point;
            this.AdvNhanVien.Name = "AdvNhanVien";
            this.AdvNhanVien.ReadOnly = false;
            size = new Size(0xf7, 20);
            this.AdvNhanVien.Size = size;
            this.AdvNhanVien.TabIndex = 0x79;
            this.AdvNhanVien.UpperText = true;
            this.AdvNhanVien.Value = "";
            this.AdvNhanVien.WidthCode = 80;
            this.Label3.AutoSize = true;
            this.Label3.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x2af, 5);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x31, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 120;
            this.Label3.Text = "M\x00e3 h\x00e0ng";
            this.CmdSeachMaHang.FlatStyle = FlatStyle.System;
            point = new System.Drawing.Point(0x318, 0x13);
            this.CmdSeachMaHang.Location = point;
            this.CmdSeachMaHang.Name = "CmdSeachMaHang";
            size = new Size(0x17, 0x16);
            this.CmdSeachMaHang.Size = size;
            this.CmdSeachMaHang.TabIndex = 0x77;
            this.CmdSeachMaHang.Text = "...";
            this.CmdSeachMaHang.UseVisualStyleBackColor = true;
            point = new System.Drawing.Point(690, 20);
            this.TxtMaHang.Location = point;
            this.TxtMaHang.Name = "TxtMaHang";
            size = new Size(0x65, 20);
            this.TxtMaHang.Size = size;
            this.TxtMaHang.TabIndex = 0x76;
            this.Label16.AutoEllipsis = true;
            this.Label16.AutoSize = true;
            this.Label16.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0xac, 4);
            this.Label16.Location = point;
            this.Label16.Name = "Label16";
            this.Label16.RightToLeft = RightToLeft.No;
            size = new Size(0x41, 13);
            this.Label16.Size = size;
            this.Label16.TabIndex = 0x72;
            this.Label16.Text = "Kh\x00e1ch h\x00e0ng";
            this.Label16.TextAlign = ContentAlignment.TopRight;
            this.AdvKhachHang.Conditions = "";
            this.AdvKhachHang.LoaiDoiTuong = modGeneral.TypeObjects.KhachHang;
            point = new System.Drawing.Point(0xaf, 20);
            this.AdvKhachHang.Location = point;
            this.AdvKhachHang.Name = "AdvKhachHang";
            this.AdvKhachHang.ReadOnly = false;
            size = new Size(0x108, 20);
            this.AdvKhachHang.Size = size;
            this.AdvKhachHang.TabIndex = 0x71;
            this.AdvKhachHang.UpperText = true;
            this.AdvKhachHang.Value = "";
            this.AdvKhachHang.WidthCode = 80;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x5b, 4);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x35, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x3f;
            this.Label1.Text = "Đến ng\x00e0y";
            this.TxtDenNgay.Format = DateTimePickerFormat.Custom;
            point = new System.Drawing.Point(90, 20);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x53, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x3e;
            this.Label13.AutoSize = true;
            this.Label13.BackColor = Color.Transparent;
            point = new System.Drawing.Point(4, 4);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x2e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x3d;
            this.Label13.Text = "Từ ng\x00e0y";
            this.TxtTuNgay.Format = DateTimePickerFormat.Custom;
            point = new System.Drawing.Point(5, 20);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x53, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 60;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new System.Drawing.Point(0, 0x2d);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x3e2, 0x23d);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 70;
            this.VSlist.VisualStyle = C1.Win.C1FlexGrid.VisualStyle.Office2007Blue;
            this.Panel2.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel2.BackgroundImageLayout = ImageLayout.Stretch;
            this.Panel2.Controls.Add(this.Panel3);
            this.Panel2.Dock = DockStyle.Bottom;
            point = new System.Drawing.Point(0, 0x26a);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0x3e2, 30);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 0x47;
            this.Panel3.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel3.BackgroundImageLayout = ImageLayout.Stretch;
            this.Panel3.Controls.Add(this.TxtTongThanhToanNT);
            this.Panel3.Controls.Add(this.Label23);
            this.Panel3.Dock = DockStyle.Right;
            point = new System.Drawing.Point(0x2d3, 0);
            this.Panel3.Location = point;
            this.Panel3.Name = "Panel3";
            size = new Size(0x10f, 30);
            this.Panel3.Size = size;
            this.Panel3.TabIndex = 0;
            this.TxtTongThanhToanNT.BorderStyle = BorderStyle.FixedSingle;
            this.TxtTongThanhToanNT.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.5f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.TxtTongThanhToanNT.FormatType = FormatTypeEnum.StandardNumber;
            point = new System.Drawing.Point(0x74, 5);
            this.TxtTongThanhToanNT.Location = point;
            this.TxtTongThanhToanNT.Name = "TxtTongThanhToanNT";
            Padding padding = new Padding(1);
            this.TxtTongThanhToanNT.Padding = padding;
            this.TxtTongThanhToanNT.ReadOnly = true;
            size = new Size(0x8b, 20);
            this.TxtTongThanhToanNT.Size = size;
            this.TxtTongThanhToanNT.TabIndex = 0x8b;
            this.TxtTongThanhToanNT.Tag = null;
            this.TxtTongThanhToanNT.TextAlign = HorizontalAlignment.Right;
            this.TxtTongThanhToanNT.VisibleButtons = DropDownControlButtonFlags.None;
            this.TxtTongThanhToanNT.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.TxtTongThanhToanNT.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.Label23.AutoSize = true;
            this.Label23.BackColor = Color.Transparent;
            this.Label23.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
            point = new System.Drawing.Point(0x1f, 9);
            this.Label23.Location = point;
            this.Label23.Name = "Label23";
            size = new Size(0x44, 13);
            this.Label23.Size = size;
            this.Label23.TabIndex = 0x8a;
            this.Label23.Text = "Tổng cộng";
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x3e2, 0x288);
            this.ClientSize = size;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel1);
            this.Controls.Add(this.Panel2);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptDoanhThuChiTiet";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-BH15";
            this.Text = "DOANH THU CHI TIET";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.VSlist.EndInit();
            this.Panel2.ResumeLayout(false);
            this.Panel3.ResumeLayout(false);
            this.Panel3.PerformLayout();
            ((ISupportInitialize) this.TxtTongThanhToanNT).EndInit();
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            this.Cursor = Cursors.WaitCursor;
            System.Data.DataTable data = (System.Data.DataTable) this.GetData("VIET");
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            int num2 = data.Rows.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                vSlist.AddItem("");
                vSlist[i + 1, 1] = RuntimeHelpers.GetObjectValue(data.Rows[i]["Ngay"]);
                vSlist[i + 1, 2] = RuntimeHelpers.GetObjectValue(data.Rows[i]["SoChungTu"]);
                vSlist[i + 1, 3] = RuntimeHelpers.GetObjectValue(data.Rows[i]["MaHang"]);
                vSlist[i + 1, 4] = RuntimeHelpers.GetObjectValue(data.Rows[i]["HangHoa"]);
                vSlist[i + 1, 5] = RuntimeHelpers.GetObjectValue(data.Rows[i]["KhachHang"]);
                vSlist[i + 1, 6] = RuntimeHelpers.GetObjectValue(data.Rows[i]["KinhDoanh"]);
                vSlist[i + 1, 8] = RuntimeHelpers.GetObjectValue(data.Rows[i]["LoaiTien"]);
                vSlist[i + 1, 9] = RuntimeHelpers.GetObjectValue(data.Rows[i]["SoLuong"]);
                vSlist[i + 1, 10] = RuntimeHelpers.GetObjectValue(data.Rows[i]["GiaList"]);
                vSlist[i + 1, 11] = RuntimeHelpers.GetObjectValue(data.Rows[i]["DonGia"]);
                vSlist[i + 1, 12] = Math.Round((double) (Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[i]["ChietKhau"]), 0, modGeneral.TypeOfValue.Nothing)) / Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[i]["SoLuong"]), 0, modGeneral.TypeOfValue.Nothing))), 2);
                vSlist[i + 1, 13] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(null, typeof(Math), "Round", new object[] { Microsoft.VisualBasic.CompilerServices.Operators.DivideObject(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[i]["HoaHong"]), 0, modGeneral.TypeOfValue.Nothing), Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[i]["SoLuong"]), 0, modGeneral.TypeOfValue.Nothing))), 2 }, null, null, null));
                vSlist[i + 1, 15] = (Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[i]["ThanhTien"]), 0, modGeneral.TypeOfValue.Nothing)) - Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[i]["ChietKhau"]), 0, modGeneral.TypeOfValue.Nothing))) - Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[i]["HoaHong"]), 0, modGeneral.TypeOfValue.Nothing));
                vSlist[i + 1, 14] = Math.Round((double) (Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(vSlist[i + 1, 15]), 0, modGeneral.TypeOfValue.Nothing)) / Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(vSlist[i + 1, 9]), 1, modGeneral.TypeOfValue.Nothing))), 2);
                vSlist[i + 1, 0x10] = RuntimeHelpers.GetObjectValue(data.Rows[i]["TyGia"]);
                vSlist[i + 1, 0x11] = Math.Round((double) (Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(vSlist[i + 1, 0x10]), 0, modGeneral.TypeOfValue.Nothing)) * Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(vSlist[i + 1, 15]), 0, modGeneral.TypeOfValue.Nothing))), 2);
            }
            this.TxtTongThanhToanNT.Value = LVYModule.SumColGrid(this.VSlist, 0x11);
            vSlist.AddItem("");
            vSlist[vSlist.Rows.Count - 1, 4] = modGeneral.Tranlated("TỔNG CỘNG", "");
            vSlist[vSlist.Rows.Count - 1, 15] = LVYModule.SumColGrid(this.VSlist, 15);
            vSlist[vSlist.Rows.Count - 1, 0x11] = LVYModule.SumColGrid(this.VSlist, 0x11);
            LVYModule.SetColorForGrid(this.VSlist, Color.GreenYellow, vSlist.Rows.Count - 1, 0, 0, 0);
            vSlist = null;
            this.Cursor = Cursors.Default;
        }

        private void TxtMaHang_LostFocus(object sender, EventArgs e)
        {
            string expression = "";
            if (this.TxtMaHang.Text.Trim() != "")
            {
                expression = SearchModule.SearchHangHoa(this.TxtMaHang.Text.Trim(), modGeneral.H_STOCKID, "");
                if (expression.Trim() != "")
                {
                    string[] strArray = Strings.Split(expression, "|", -1, CompareMethod.Binary);
                    this.TxtMaHang.Tag = strArray[0];
                    this.TxtMaHang.Text = strArray[1];
                }
                else
                {
                    this.TxtMaHang.Tag = "";
                    this.TxtMaHang.Text = "";
                }
            }
            else
            {
                this.TxtMaHang.Tag = "";
                this.TxtMaHang.Text = "";
            }
        }

        private void TxtTuNgay_LostFocus(object sender, EventArgs e)
        {
            if (LVYModule.sRight(this.TxtTuNgay.Text, 7) != LVYModule.sRight(this.TxtDenNgay.Text, 7))
            {
                this.TxtDenNgay.Text = DateTime.DaysInMonth(Conversions.ToInteger(LVYModule.sRight(this.TxtTuNgay.Text, 4)), Conversions.ToInteger(LVYModule.sMid(this.TxtTuNgay.Text, 4, 2))).ToString() + "/" + LVYModule.sRight(this.TxtTuNgay.Text, 7);
            }
        }

        internal virtual ADVObjects AdvKhachHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvKhachHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvKhachHang = value;
            }
        }

        internal virtual ADVObjects AdvNhanVien
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvNhanVien;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvNhanVien = value;
            }
        }

        internal virtual ComboBox CboLoaiTien
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboLoaiTien;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboLoaiTien = value;
            }
        }

        internal virtual System.Windows.Forms.Button CmdExel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExel_Click);
                if (this._CmdExel != null)
                {
                    this._CmdExel.Click -= handler;
                }
                this._CmdExel = value;
                if (this._CmdExel != null)
                {
                    this._CmdExel.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdLoad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdLoad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdLoad_Click);
                if (this._CmdLoad != null)
                {
                    this._CmdLoad.Click -= handler;
                }
                this._CmdLoad = value;
                if (this._CmdLoad != null)
                {
                    this._CmdLoad.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdSeachMaHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdSeachMaHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdSeachMaHang_Click);
                if (this._CmdSeachMaHang != null)
                {
                    this._CmdSeachMaHang.Click -= handler;
                }
                this._CmdSeachMaHang = value;
                if (this._CmdSeachMaHang != null)
                {
                    this._CmdSeachMaHang.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label11
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label11;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label11 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label16
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label16;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label16 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label23
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label23;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label23 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual Panel Panel3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel3 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual System.Windows.Forms.TextBox TxtMaHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtMaHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtMaHang_LostFocus);
                if (this._TxtMaHang != null)
                {
                    this._TxtMaHang.LostFocus -= handler;
                }
                this._TxtMaHang = value;
                if (this._TxtMaHang != null)
                {
                    this._TxtMaHang.LostFocus += handler;
                }
            }
        }

        internal virtual C1NumericEdit TxtTongThanhToanNT
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTongThanhToanNT;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTongThanhToanNT = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtTuNgay_LostFocus);
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus -= handler;
                }
                this._TxtTuNgay = value;
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus += handler;
                }
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

